
//
//  WalletBankListViewController.m
//  LuxuryGoods
//
//  Created by DCQ on 2018/8/9.
//  Copyright © 2018年 Future. All rights reserved.
//

#import "WalletBankListViewController.h"

@interface WalletBankListViewController ()
@property(nonatomic, strong) NSArray *bankList;
@end

@implementation WalletBankListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setNavigationItemTitle:@"银行"];
  
    WEAKSELF
    [[MainApi sharedInstance] postPath:@"Wallet/getBankList" params:nil resultBlock:^(NSDictionary *responseObject, NSError *error) {
        STRONGSELF
        if (!error) {
            self.bankList = responseObject[@"data"];
        }
        [strongSelf updateTableView];
    }];
}
- (void)registerCell{
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"UITableViewCellIdentifier"];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    NSInteger rows = 0;
    rows = [self.bankList count];
    return rows;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    CGFloat height = 0;
    height = 44;
    return height;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCellIdentifier"];
    NSDictionary * bankInfo  = self.bankList[indexPath.row];
    cell.textLabel.text = bankInfo[@"bank_name"];
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    if (self.selectedBlock) {
        self.selectedBlock(self.bankList[indexPath.row]);
    }
    [self backViewController];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
